<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="济南本地同城信息平台，提供招聘求职、房屋租售、二手交易、寻人寻物、吃喝玩乐等生活服务信息，快速发布和查找您需要的本地信息">
  <meta name="keywords" content="济南便民同城">
  <meta name="robots" content="index, follow">
  <meta name="author" content="济南便民港">
  <link rel="canonical" href="https://pc.jngkxx.top">

  <!-- 社交媒体Meta标签 -->
  <meta property="og:title" content="济南便民港 - 本地生活服务平台">
  <meta property="og:description" content="提供全面的本地生活服务信息，包括招聘、租房、二手交易等">
  <meta property="og:type" content="website">
  <meta property="og:url" content="https://pc.jngkxx.top">
  <meta property="og:image"
    content="https://file.jngkxx.top/%E6%B3%89%E5%9F%8E%E7%94%9F%E6%B4%BB%E6%B4%BE%EF%BC%88%E6%96%B0%EF%BC%89/%E7%B3%BB%E7%BB%9F%E6%96%87%E4%BB%B6/logo/logo.png">

  <!-- Twitter卡片 -->
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:title" content="济南便民港 - 本地生活服务平台">
  <meta name="twitter:description" content="提供全面的本地生活服务信息，包括招聘、租房、二手交易等">
  <meta name="twitter:image"
    content="https://file.jngkxx.top/%E6%B3%89%E5%9F%8E%E7%94%9F%E6%B4%BB%E6%B4%BE%EF%BC%88%E6%96%B0%EF%BC%89/%E7%B3%BB%E7%BB%9F%E6%96%87%E4%BB%B6/logo/logo.png">

  <link href="css/detail.css" rel="stylesheet" type="text/css" media="all" />
  <!-- 网站图标 -->
  <link rel="icon" href="/favicon.ico" type="image/x-icon">
  <link rel="apple-touch-icon" href="/apple-touch-icon.png">

  <script src="js/jquery-1.11.0.min.js"></script>
  <!-- 引入 Simple Paging Plugin -->
  <script src="js/jquery.simplePagination.js"></script>


  <script>
    var _hmt = _hmt || [];
    (function () {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?3870faa0024f9253fdce6fd555ff25d7";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>

  <!-- 结构化数据 -->
  <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "WebSite",
      "name": "济南便民港",
      "url": "https://pc.jngkxx.top",
      "potentialAction": {
        "@type": "SearchAction",
        "target": "https://pc.jngkxx.top/search?q={济南便民港}",
        "query-input": "required name=济南便民港"
      }
    }
    </script>

  <title>济南便民港 - 帖子详情</title>
</head>

<body>
  <div class="container">
    <div class="post-header">
      <h1></h1>
    </div>

    <div class="post-card">
      <div class="post-meta">
        <div class="author-info">
          <div class="author-avatar"></div>
          <div class="author-details">
            <h3>张三</h3>
            <div class="post-date"><i class="far fa-clock"></i> <span class="post-date-value"></span></div>
          </div>
        </div>
        <div class="post-views">
          <i class="far fa-eye"></i> <span class="post-views-value"></span>次浏览
        </div>
      </div>

      <div class="post-content">
        <pre class="post-content-text"></pre>
        <div class="image-gallery">
          <!-- <img
            src="https://images.unsplash.com/photo-1519861531473-9200262188bf?ixlib=rb-1.2.1&auto=format&fit=crop&w=300&q=80"
            alt="篮球1" class="gallery-image"> -->
        </div>
        <p>联系我时，请说是在济南便民港上看到的，谢谢!</p>
      </div>

      <div class="post-actions">
        <div class="action-group">
          <a href="#" class="action-btn"><i class="far fa-thumbs-up"></i> 点赞 (
            <span class="action-btn-praiseCount"></span>)</a>
          <a href="#" class="action-btn"><i class="far fa-comment"></i> 分享 (
            <span class="action-btn-forwardCount"></span>)</a>
          <a href="#" class="action-btn"><i class="fas fa-share"></i> 浏览 (
            <span class="action-btn-browseCount"></span>)</a>
        </div>
        <a href="#" class="contact-btn" id="show-contact"><i class="fas fa-envelope"></i> 联系作者</a>
      </div>
    </div>

    <div class="comments-section">
      <h2 class="section-title"><i class="far fa-comments"></i> 评论 <span class="comment-count">3</span></h2>




    </div>
  </div>

  <!-- 回复表单 (动态生成) -->
  <div class="comment-form reply-form" id="reply-form" style="display: none;">
    <h3 class="form-title">回复评论</h3>
    <textarea placeholder="写下你的回复..."></textarea>
    <button type="submit" class="submit-btn"><i class="fas fa-paper-plane"></i> 提交回复</button>
    <button type="button" class="submit-btn cancel-reply"
      style="background: var(--gray-color); margin-left: 10px;">取消</button>
  </div>

  <script>
    // 回复评论功能
    document.querySelectorAll('.reply-btn').forEach(btn => {
      btn.addEventListener('click', function (e) {
        e.preventDefault();
        const commentId = this.getAttribute('data-comment-id');
        const commentElement = document.getElementById(commentId);

        // 移除现有的回复表单
        const existingForm = document.querySelector('.reply-form.visible');
        if (existingForm) {
          existingForm.remove();
        }

        // 克隆回复表单
        const replyForm = document.getElementById('reply-form').cloneNode(true);
        replyForm.style.display = 'block';
        replyForm.classList.add('visible');

        // 插入到评论下方
        commentElement.parentNode.insertBefore(replyForm, commentElement.nextSibling);

        // 取消按钮事件
        replyForm.querySelector('.cancel-reply').addEventListener('click', function () {
          replyForm.remove();
        });

        // 滚动到表单
        replyForm.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
      });
    });

  </script>
  <script>
    let obj = {
      newsId: getUrlParameter('id')
    }
    list()
    // 获取帖子列表
    function list() {
      $.ajax({
        url: "https://qcsh.jngkxx.top/wx/news/newsDetails",
        dataType: "json",
        type: "get",
        async: "true/false",
        data: obj,
        success: function (res) {
          const { data } = res
          setDom(data)
        },
        error: function (err) {
          console.log('--------', err)
        }
      });
    }
    function setDom(data) {
      console.log('data-----------', data)
      // 标题
      $(".post-header H1").text(data.genreName)
      // 用户信息
      $(".author-details H3").text(data.contactName)
      $(".author-avatar").html(`<img src="${data.releaseUserAvatar}" alt="用户头像">`)
      $(".post-date-value").text(data.refreshTimeDesc)
      $(".post-views-value").text(data.browseCount)
      $(".post-content-text").text(data.content)
      // 图片列表
      var htmlStrings = data.fileList.map(createImgHTML);
      var $items = $.parseHTML(htmlStrings.join('')); // 将所有字符串合并成一个并转换为jQuery对象
      $(".image-gallery").html('')
      $(".image-gallery").append($items); // 添加到容器中
      // 点赞
      $(".action-btn-praiseCount").text(data.praiseCount)
      // 分享
      $(".action-btn-forwardCount").text(data.forwardCount)
      // 浏览
      $(".action-btn-browseCount").text(data.browseCount)

    }
    // 定义一个函数来生成图片列表字符串
    function createImgHTML(item) {
      return ` <img class="gallery-image" src="${item.fileUrl}" alt="${item.fileName}">`;
    }
    // 获取window路径后面的参数
    function getUrlParameter(name) {
      const urlParams = new URLSearchParams(window.location.search);
      return urlParams.get(name);
    }

  </script>
</body>

</html>